package com.ouc.openplatform.zykt.standardManage.service.impl;

import java.util.List;

import com.ouc.openplatform.zykt.standardManage.dao.NJ_TestStandardTempletDAO;
import com.ouc.openplatform.zykt.standardManage.model.NJ_TestStandardTemplet;
import com.ouc.openplatform.zykt.standardManage.service.NJ_TestStandardTempletService;


public class NJ_TestStandardTempletServiceImpl implements NJ_TestStandardTempletService {

	NJ_TestStandardTempletDAO testStandardTempletServiceDAO;

	public NJ_TestStandardTempletDAO getTestStandardTempletDAO() {

		return testStandardTempletServiceDAO;
	}

	public void setTestStandardTempletDAO(NJ_TestStandardTempletDAO testStandardTempletDAO) {
		this.testStandardTempletServiceDAO = testStandardTempletDAO;
	}

	@Override
	public List<NJ_TestStandardTemplet> searchAllTestStandard(int page, int rows) {
		System.out.println("开始查询");
		return testStandardTempletServiceDAO.searchAllTestStandard(page, rows);
	}

	@Override
	public List<NJ_TestStandardTemplet> searchTestStandardByCondition(String std_type, int pd_type, String std_name,
			String std_code, int startIndex, int endIndex) {
		// System.out.println("pd_type"+pd_type);
		return testStandardTempletServiceDAO.searchTestStandardByCondition(std_type, pd_type, std_name, std_code,
				startIndex, endIndex);
	}

	@Override
	public int insertTestStandard(NJ_TestStandardTemplet std) {
		int result = 0;
		int tmp = checkName(std.getTemplate_name());
		System.out.println("插入标准");
		System.out.println("tmp:" + tmp);
		if (tmp == 0) {
			result = testStandardTempletServiceDAO.insertTestStandard(std);
		}
		if (tmp != 0) {
			result = 7;
		}
		System.out.println("result:" + result);
		return result;
	}

	@Override
	public int deleteTestStandard(int template_id) {

		int num = testStandardTempletServiceDAO.deleteTestStandard(template_id);
		System.out.println("标准删除：" + template_id + "数目" + num);
		return num;

		// return testStandardTempletServiceDAO.deleteTestStandard(id);

	}

	@Override
	public int editTestStandard(NJ_TestStandardTemplet std) {

		int num = testStandardTempletServiceDAO.editTestStandard(std);
		System.out.println(num);
		return num;

		// return testStandardTempletServiceDAO.editTestStandard(std);

	}

	@Override
	public int getSearchTestStandardByConditionCount(String std_type, int pd_type, String std_name, String std_code) {
		//
		return testStandardTempletServiceDAO.getSearchTestStandardByConditionCount(std_type, pd_type, std_name,
				std_code);
	}

	@Override
	public int getSearchAllTestStandardCount() {
		//
		return testStandardTempletServiceDAO.getSearchAllTestStandardCount();
	}

	@Override
	public List<NJ_TestStandardTemplet> getAllTestStandard() {
		//
		return testStandardTempletServiceDAO.getAllTestStandard();
	}

	@Override
	public int checkName(String template_name) {
		// TODO Auto-generated method stub
		int t = 0;
		System.out.println("检测标准名称");
		t = testStandardTempletServiceDAO.checkName(template_name);
		System.out.println("t:" + t);
		return t;

	}

	@Override
	public int getProductTypeByName(String name) {

		return testStandardTempletServiceDAO.getProductTypeByName(name);
	}

	@Override
	public String getUsernoByName(String name) {
		// TODO Auto-generated method stub
		return testStandardTempletServiceDAO.getUsernoByName(name);
	}

	@Override
	public int importByExcel(NJ_TestStandardTemplet std) {
		System.out.println("biz TestStandardTemplet 导入excel：");
		return testStandardTempletServiceDAO.importByExcel(std);
	}

	@Override
	public int importByList(List<NJ_TestStandardTemplet> tstList) {
		// TODO Auto-generated method stub
		System.out.println("biz tstList.eName:" + tstList.get(0).getTemplate_englishname());
		return testStandardTempletServiceDAO.importByList(tstList);
	}

}
